import { createStore } from 'vuex'
import tokenUtil from "@/utils/tokenUtil";

export default createStore({
  state: {
    token: tokenUtil.getToken(),
    //登录用户信息
    userInfo: null,
    //菜单信息
    menuRoutes: null,
  },
  mutations: {
    setToken(state, data){
      state.token = data;
      tokenUtil.setToken(data);
    },
    setUserInfo(state, data){
      state.userInfo = data;
    },
    setMenuRoutes(state, data){
      state.menuRoutes = data;
    }
  },
  actions: {
  },
  modules: {
  }
})
